﻿package org.net 
{
	import mx.rpc.soap.WebService;
	import mx.rpc.events.FaultEvent.FAULT
	import mx.rpc.events.ResultEvent.RESULT
	
	import org.abcFrame.core.*;
	import org.net.*;
	import org.enmu.*;
	
	public class AbcWebService
	{
		private var path:String
		private var responder:AbcResponder
		
		public function AbcWebService(path:String,responder:AbcResponder):void 
		{
			
			this.path=path
				
			this.responder=responder
				
			var path:String="http://localhost/dxl_green_web/testws.asmx?wsdl"
		
			var myWebSrvc:WebService = new WebService(path); 
			
			myWebSrvc.addEventListener(ResultEvent.RESULT,resultEvent)
				
			myWebSrvc.addEventListener(FaultEvent.FAULT,faultEvent)
		}
		
		function resultEvent(e:ResultEvent){
			
			if(responder.onResult!=null)responder.onResult(e.result,path);

		}
		
		function faultEvent(e:FaultEvent){
			
			AbcEventDispatcher.instance.dispatcher(AbcEventType.WEBSERVICEEVENT,"completeHandler:处理"+path+"返回结果的responder函数出错了,可能是参数或是逻辑错误！"+error.message)
		
		}
		
	}

}
